package edu.scu.declaresys.vo;

import java.util.Date;

import edu.scu.declaresys.dao.util.Column;
import edu.scu.declaresys.dao.util.FieldWalker;
import edu.scu.declaresys.dao.util.Table;


/**
 * 
 * @author: zt
 * @since : 2013-7-3
 */
@Table(code = LoginLog.T_TABLE)
public class LoginLog implements java.io.Serializable
{
	private static final long	serialVersionUID	= 8598225472573000184L;
	//
	// table column name.
	//
	public static final String	T_TABLE				= "login_log";
	public static final String	T_ID				= "id";
	public static final String	T_USER_NAME			= "userName";
	public static final String	T_USER_IP			= "userIp";
	public static final String  T_EVENT				= "event";
	public static final String	T_TIME				= "time";
	//
	// Fields
	//
	@Column(code = T_ID)
	private Integer				id;
	
	@Column(code = T_USER_NAME)
	private String				userName;
	
	@Column(code = T_USER_IP)
	private String				userIp;
	
	@Column(code=T_EVENT)
	private String 				event;
	
	@Column(code = T_TIME)
	private Date				time;
	
	//
	//Reference
	//
	private User user;
	
	//
	// Constructors
	//
	public LoginLog()
	{
	}
	
	
	
	public LoginLog(Integer id, String userName, String userIp, String event,
			Date time)
	{
		super();
		this.id = id;
		this.userName = userName;
		this.userIp = userIp;
		this.event = event;
		this.time = time;
	}



	//	
	// Override functions.
	//
	public String toString()
	{
		return FieldWalker.makeNonstaticFields(this, FieldWalker.WITHOUT_NULL);
	}
	
	@Override
	public int hashCode()
	{
		return id.hashCode();
	}

	@Override
	public boolean equals(Object obj)
	{
		if(this == obj)
		{
			return true;
		}
		if(obj == null)
		{
			return false;
		}
		if(!(obj instanceof LoginLog))
		{
			return false;
		}
		//
		return this.id.equals(((LoginLog)obj).id);
	}

	//
	// Getters and Setters
	//
	public Integer getId()
	{
		return this.id;
	}
	
	public void setId(Integer id)
	{
		this.id = id;
	}
	
	public String getUserName()
	{
		return userName;
	}

	public void setUserName(String userName)
	{
		this.userName = userName;
	}

	public String getUserIp()
	{
		return this.userIp;
	}
	
	public void setUserIp(String userIp)
	{
		this.userIp = userIp;
	}
	
	public String getEvent()
	{
		return event;
	}


	public void setEvent(String event)
	{
		this.event = event;
	}


	public Date getTime()
	{
		return time;
	}


	public void setTime(Date time)
	{
		this.time = time;
	}

	public User getUser()
	{
		return user;
	}
	
	public void setUser(User user)
	{
		this.user = user;
	}


}
